<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>监室管理系统 - 用户注册</title>
    <link rel="stylesheet" href="/static/styles.css">
</head>
<body>
    <div class="form-container">
        <h1 class="register-title">监室管理系统</h1>

        {% if error %}
        <div class="alert alert-danger">
            {{ error }}
        </div>
        {% endif %}

        <form method="post" action="/register">
            <div class="form-group">
                <label for="username">用户名</label>
                <input type="text" class="form-control" id="username" name="username" required>
            </div>

            <div class="form-group">
                <label for="full_name">姓名</label>
                <input type="text" class="form-control" id="full_name" name="full_name" required>
            </div>

            <div class="form-group">
                <label for="phone">电话</label>
                <input type="text" class="form-control" id="phone" name="phone" required>
            </div>

            <div class="form-group">
                <label for="role_id">岗位</label>
                <select class="form-control" id="role_id" name="role_id" required>
                    <option value="">请选择岗位</option>
                    {% for role in roles %}
                    <option value="{{ role.id }}">{{ role.name }}</option>
                    {% endfor %}
                </select>
            </div>

            <div class="form-group">
                <label for="password">密码</label>
                <input type="password" class="form-control" id="password" name="password" required>
            </div>

            <div class="form-group">
                <label for="confirm_password">确认密码</label>
                <input type="password" class="form-control" id="confirm_password" name="confirm_password" required>
            </div>

            <!-- 隐藏的用户类型字段，默认为普通用户 -->
            <input type="hidden" name="user_type" value="normal">

            <button type="submit" class="btn">注册</button>
        </form>

        <div class="login-link">
            <p>已有账号？<a href="/login">立即登录</a></p>
        </div>
    </div>
</body>
</html>
